package com.gandong8.derby.controller;

import com.gandong8.derby.core.response.ResponseData;
import com.gandong8.derby.pojo.vo.response.UserLogResVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 操作日志控制层
 * @author xiaoyutou
 */
@Controller
public class UserLogController extends BaseController{

    @RequestMapping(value = "/log/index")
    @ResponseBody
    public ModelAndView logPage() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("log.html");
        return modelAndView;
    }

    @RequestMapping(value = "/log/ajax/list")
    @ResponseBody
    public ResponseData ajaxList( ) {
        List<UserLogResVO> resList = new ArrayList<>();
        UserLogResVO obj = new UserLogResVO();
        obj.setId(1);
        obj.setRequestIp("127.0.0.1");
        obj.setRequestPath("/log/index");
        obj.setRequestTime(new Date());
        resList.add(obj);
        return ResponseData.succPage(resList, 1);
    }

    @RequestMapping(value = "/log/ajax/del",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData ajaxDel() {
        return ResponseData.succ();
    }


}
